const { app, BrowserWindow } = require('electron')
let win
function createWindow(){
    win = new BrowserWindow({
        width: 1200, 
        height: 800,
        //避免require问题
        webPreferences: {
            nodeIntegration: true,
            contextIsolation: false
        } 
    })
    const indexPageUrl = `file://${__dirname}/dist/index.html`
    win.webContents.openDevTools()
    win.loadURL(indexPageUrl)
    win.on('closed', ()=>{
        win = null
    })
}

app.on('ready', createWindow)
app.on('window-all-closed', ()=>{
    if(process.platform !== 'darwin'){
        app.quit()
    }
})